MySQL 5.7.17 版本,mysql库user表没有password字段,如何修改密码? |
您所在的位置:网站首页 › edgeflags没有password import › MySQL 5.7.17 版本,mysql库user表没有password字段,如何修改密码? |
好记性不如烂笔头呀~ MySQL 5.7.17 忘记密码,在my.cnf配置文件加入skip-grant-tables,重启免密码登录mysql进行修改的时候发现修改语句是错误的,语句如下: update user set password=password('123456') where user='root'; flush privileges;这里参考:https://blog.csdn.net/inslow/article/details/54291182 后面查阅资料发现,MySQL 5.7.17版本已经不使用password来作为密码的字段了 而改成了authentication_string,将修改语句改为如下即可: update user set authentication_string=password('123456') where user='root'; flush privileges;这里参考:https://www.cnblogs.com/benjamin77/p/8681763.html 修改完了密码,要把my.cnf配置文件的skip-grant-tables删掉或者屏蔽掉,重启启动mysql才行,不然不需要权限验证,万一又允许外网访问,那么跟裸奔没什么区别了。 另外,如知道了登录密码,想要修改密码的话,语句为: alter user 'root'@'localhost' identified by '新密码'; flush privileges; |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |